<%@ include file="header.jsp" %>

<c:if test="${empty sessionScope.user_id}">
	<jsp:forward page="/form/login.jsp" />
</c:if>

<h1>Mes Souhaits</h1>
<hr style="clear : both" />
<c:forEach var="souhait" items="${requestScope.souhaits}" >
	<div class="infosVendeur">
		<c:choose>
			<c:when test="${empty requestScope.action}">
				<a href="form/ajoutsouhait?produit=${souhait.key.id}&action=update">Modifier</a><br />
				<a href="supprimersouhait?souhait=${souhait.key.id}">Supprimer</a>
			</c:when>
			<c:otherwise>
				<a href="Annonce?annonce=${souhait.value.idAnnonce}">Voir l'annonce</a>
			</c:otherwise>
		</c:choose>
	</div>
	
	<div class="message">
		<div class="cadreAvatar">
			<img src="/MiniIBay/images/${souhait.key.photo}" class="avatar_message" alt="Photo du produit" />
		</div>
		<div style="float : left;">
			<b><a href="/MiniIBay/produit?produit=${souhait.key.id}">${souhait.key.intitule}</a></b><br />
			<p class="infosSmall">Cr&eacute;e le : ${souhait.value.date}</p>
			Prix : ${souhait.value.prix}<br/>
			${souhait.value.commentaire}
		</div>
		<hr style="clear : both" />
	</div>
</c:forEach>

<div class="barreGrise">
	<div class="gauche">Page &nbsp;&nbsp;
		<c:if test="${requestScope.page > 1}">
			<a href="messouhaits?page=1&action=${requestScope.action}" style="text-decoration : none" title="premi&egrave;re page"><<</a>
		</c:if>
		&nbsp;&nbsp;
		<c:if test="${requestScope.page > 1}">
			<a href="messouhaits?page=${requestScope.page - 1}&action=${requestScope.action}" style="text-decoration : none" title="page pr&eacute;c&eacute;dente"><</a>
		</c:if>
		&nbsp;
		
		<c:forEach var="num" begin="${requestScope.page-5 < 1 ? 1 : requestScope.nb_results - 5}" end="${requestScope.page-1}" >
			<a href="messouhaits?page=${num}&action=${requestScope.action}">${num}</a>
		</c:forEach>
		
		<c:choose>
			<c:when test="${empty requestScope.page}">
				<b>1</b>
			</c:when>
			<c:otherwise>
				<b>${requestScope.page}</b>
			</c:otherwise>
		</c:choose>
		
		<c:forEach var="num" begin="${requestScope.page + 1}" end="${requestScope.page + 5 > requestScope.nb_results ? requestScope.nb_results : requestScope.page + 5}" >
			<a href="messouhaits?page=${num}&action=${requestScope.action}">${num}</a>
		</c:forEach>
		
		&nbsp;
		<c:if test="${requestScope.page < requestScope.nb_results}">
			<a href="messouhaits?page=${requestScope.page + 1}&action=${requestScope.action}" style="text-decoration : none" title="page suivante">></a>
		</c:if>
		&nbsp;&nbsp;
		<c:if test="${requestScope.page < requestScope.nb_results}">
			<a href="messouhaits?page=${requestScope.nb_results}&action=${requestScope.action}" style="text-decoration : none" title="derni&egrave;re page">>></a>
		</c:if>
	</div>
</div>
<br style="clear : both;" />

<%@ include file="footer.jsp" %>